<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div style="vertical-align: ">
        <span>px</span>
        <input onkeyup="calculate(this.value)">
    </div>
    <span id="value"></span>
<script type="text/javascript">
    function calculate(str) {
        var v=parseFloat(str)
        var scale=2;
        document.getElementById("value").innerText=(v/scale+0.5).toString();
    }
</script>
</body>
</html>